import { mapGetters, mapMutations, mapActions } from 'vuex'
// import { createNamespacedHelpers } from 'vuex'
// const { mapGetters, mapState, mapActions } = createNamespacedHelpers('sidebar')

export const sidebarMixin = {
  mounted() {
    // console.log(this.$store.contentSidebarState)
  },
  computed: {
    ...mapGetters('sidebar', [
      'contentSidebarState',
      'mineSidebarState',
      'screenSize'
    ]),
  },
  methods: {
    ...mapActions('sidebar', [
      'hideContentSidebar',
      'hideMineSidebar'
    ]),
    hideSidebar() {
      if (this.mineSidebarState === true) {
        this.hideMineSidebar()
      }
      if (this.contentSidebarState === true && this.screenSize === 'small-screen') {
        this.hideContentSidebar()
      }
    }
  }
}


import SelectTab from 'views/login/components/select-tab.vue'
import Form from 'common/form/form.vue'
import FormItem from 'common/form/form-item.vue'
import SubmitButton from 'common/form/submit-button'
import ErrorMsg from 'common/form/error-message'

export const fromMixin = {
  data() {
    return {
      type: 'phone'  // phone or email
    }
  },
  computed: {
    formItemsData() {
      return this.formItems[this.type].map(key => this.model[key])
    }
  },
  methods: {
    selectType(index) {
      switch (parseInt(index)) {
        case 0:
          this.type = 'phone'
          break
        case 1:
          this.type = 'email'
          break
      }
    },
    handleErrMsg(errMsg) {
      this.errMsg = errMsg
    },
  },
  watch: {
    type() {
      this.errMsg = ''
    }
  },
  components: {
    SelectTab,
    Form,
    FormItem,
    SubmitButton,
    ErrorMsg
  }
}